@extends('layouts.header')
@inject('sender','App\Http\Controllers\WroteitController')
@section('content')
    <h2>Outbox</h2>
    @foreach($messages as $message)
        @if (Auth::user()->id == $message->from_id)
            <h4><a href="{{ route('show_message2',['mes'=>$message->id]) }} " title="Show message">{{$message->title}}</a> from {{$sender::getSender($message)->name}} 
            at {{$message->created_at}}</h4>
        @endif
    @endforeach
    <form action="{{ route('new_message')}}" method="GET">
        <button type="submit">New message...</button>
    </form>
@endsection()